refactor(capability_matching): move serving-time routing logic to data_plane - #406
Merged
zzylol merged 3 commits intoJul 22, 2026
Merged
Conversation
…a_plane asap_types::capability_matching mixed a genuinely shared type (StorageBackend, a real field on the shared StreamingConfig wire format) with routing *decisions* that have zero control_plane callers. Confirmed via full-repo grep: compatible_storage_backends' only real callers are both inside data_plane/query_engines/routing/ query_engine_routing.rs; AccuracyTarget is never a shared-struct field, only a parameter to that function. Moved to a new data_plane/src/query_engines/routing/capability_matching.rs: AccuracyTarget, compatible_storage_backends, and their three tests. asap_types keeps StorageBackend, its data_source_id/parse helpers, and the ENGINE_ID_*/CANONICAL_QUERY_ENGINE_IDS constants they're tightly coupled to -- these stay because StorageBackend is a real StreamingConfig field, not because anything here calls the routing logic. Also deleted two more confirmed-dead functions surfaced by this audit (same "grep for real callers, not comment mentions" method as the find_compatible_aggregation cleanup): compatible_agg_types (zero callers outside its own now-deleted test) and required_sub_type (zero callers anywhere). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…d.rs Follow-up to the previous commit: with the routing/matching logic moved to data_plane, this file only contains StorageBackend and its string-mapping helpers -- "capability_matching" no longer describes its contents, and the name collided with two other, unrelated capability_matching.rs files (control_plane/sketch_algebra's own capability classifier, and the new one in data_plane/query_engines/routing). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Correction to the previous commit's reasoning: I'd claimed
control_plane needed StorageBackend because it's a StreamingConfig
field control_plane constructs. That was never actually verified --
every real (non-comment) StreamingConfig mention in control_plane is
its own, separately-typed StreamingConfigEmitter, which hand-builds
wire-compatible JSON via serde_json::Value and never imports
asap_types::StreamingConfig or StorageBackend at all.
The one thing that looked like real coupling -- PolicyRegistry::
from_streaming_config(&StreamingConfig) -- was pure sugar over
from_configs with exactly one real caller anywhere in the workspace:
StreamingConfig::policy_registry() itself. control_plane's own
production code (asap_tier_analysis.rs) only ever calls
PolicyRegistry::from_configs directly.
So StreamingConfig and StorageBackend move to
data_plane/src/storage_engines/types/, alongside the config types
already re-exported there. PolicyRegistry::from_streaming_config{,
_with_collisions} are deleted from asap_types (dead once their only
caller moves); StreamingConfig::policy_registry() now calls
PolicyRegistry::from_configs directly.
MonitorSpec stays in asap_types, split out to its own file --
unlike StreamingConfig/StorageBackend, control_plane genuinely needs
it: emit/monitor.rs hand-builds the StreamingConfig.monitors[] JSON
entry and has a real regression test deserializing it into this exact
type, and control_plane cannot depend on data_plane (the dependency
runs the other way) to reach a data_plane-hosted definition.
All real call sites across data_plane updated to
crate::storage_engines::types::{StreamingConfig, StorageBackend, ...}.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
zzylol
deleted the
refactor/split-serving-time-capability-routing-to-data-plane
branch
July 22, 2026 16:47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to the
find_compatible_aggregationdead-code audit (#404) — auditing the rest ofasap_types::capability_matching.rsfor what's genuinely shared vs. what only looks shared because it's housed in the shared crate.compatible_storage_backends's only two real callers are both insidedata_plane/src/query_engines/routing/query_engine_routing.rs.AccuracyTargetis never a field on any shared struct -- only a parameter to that function.control_planehas zero callers of either.StorageBackendstays inasap_types-- it's a real field on the sharedStreamingConfigwire format bothcontrol_plane(constructs) anddata_plane(serves against) need to agree on. Itsdata_source_id/parse_storage_backend_engine_idhelpers andENGINE_ID_*/CANONICAL_QUERY_ENGINE_IDSconstants stay alongside it since they're tightly coupled to the type itself, not the routing decision.AccuracyTarget+compatible_storage_backends(+ their 3 tests) to a newdata_plane/src/query_engines/routing/capability_matching.rs, re-exported fromrouting::mod.compatible_agg_typesandrequired_sub_type. Deleted both, along withcompatible_agg_types's one test (which only exercised the dead function).Test plan
cargo build --workspace-- cleancargo test -p asap_types -p control_plane -p data_plane --no-run-- all targets compilecargo test -p asap_types --lib-- 32 passed, 0 failedcargo test -p data_plane --lib capability_matching-- 3 passed (the moved tests, in their new home)cargo test -p asap_types -p control_plane -p data_plane --lib -- --test-threads=1-- 822 passed control_plane (1 pre-existing unrelated failure, confirmed in chore: retire promql_utilities crate, move AggregationType into asap_types #403/feat(asap_types): retire WindowType in favor of asap_ir::WindowKind #405), rest cleanrustfmtapplied to touched files only🤖 Generated with Claude Code